﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Common="clr-namespace:Snipps.Infrastructure" xmlns:Controls="clr-namespace:Snipps.Controls">

    <ResourceDictionary.MergedDictionaries>
        <Common:SharedResourceDictionary Source="/Snipps;component/Resources/NamedStyles/ColorBorderOnFocusStyle.xaml" />
    </ResourceDictionary.MergedDictionaries>


    <DataTemplate x:Key="TagDataTemplate">
        <Border x:Name="border"
                Margin="3,0,3,0"
                Background="{DynamicResource ForegroundBrush}">
            <TextBlock Margin="4,0,4,0"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"
                       Text="{Binding Name}"
                       TextWrapping="NoWrap" />
        </Border>
    </DataTemplate>

    <Style BasedOn="{StaticResource ColorBorderOnFocusStyle}"
           TargetType="{x:Type Controls:TagsTextBox}">
        <Setter Property="FontSize" Value="{DynamicResource TxtBoxFontSize}" />
        <Setter Property="TokenTemplate" Value="{StaticResource TagDataTemplate}" />
        <Setter Property="CaretBrush" Value="{DynamicResource ForegroundBrush}" />
        <Setter Property="Background" Value="{DynamicResource BackgroundBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:TagsTextBox}">
                    <ControlTemplate.Resources>
                        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
                    </ControlTemplate.Resources>
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <TextBlock Name="PART_Watermark"
                                       Margin="1,0,0,0"
                                       FontStyle="Italic"
                                       Foreground="{DynamicResource DisableBrush}"
                                       Text="{TemplateBinding WatermarkText}" />
                            <ScrollViewer x:Name="PART_ContentHost" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>